package com.example.common.exception;

import com.example.common.enums.HttpStatus;

/**
 * 自定义异常基类
 */
public abstract class IException extends RuntimeException {

    private static final long serialVersionUID = -1582874427218948396L;
    private Integer code;
    private Object[] args;

    IException() {
        super();
    }

    IException(String message, Throwable cause) {
        super(message, cause);
    }

    IException(String message) {
        super(message);
    }

    public IException(HttpStatus status) {
        super(status.msg());
        this.code = status.code();
    }

    public IException(String message, Object[] args, Throwable cause) {
        super(message, cause);
        this.args = args;
    }

    public IException(String message, Object[] args) {
        super(message);
        this.args = args;
    }

    public IException(Integer code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    IException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public IException(Integer code, String message, Object[] args, Throwable cause) {
        super(message, cause);
        this.args = args;
        this.code = code;
    }

    public IException(Integer code, String message, Object[] args) {
        super(message);
        this.args = args;
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object[] getArgs() {
        return args;
    }

    public void setArgs(Object[] args) {
        this.args = args;
    }
}
